//
//  MyCollectionReusableView.m
//  project_delicious
//
//  Created by dlios on 15-3-26.
//  Copyright (c) 2015年 lanou3g.com 蓝鸥科技. All rights reserved.
//

#import "MyCollectionReusableView.h"

@implementation MyCollectionReusableView
- (instancetype)initWithFrame:(CGRect)frame
{
    
    
    self = [super initWithFrame:frame];
    if (self) {
        self.myImageView = [[UIImageView alloc] init];
        [self addSubview:self.myImageView];
        [_myImageView release];
        self.label = [[UILabel alloc] init];
        [self addSubview:self.label];
        [_label release];
        self.backImageView = [[UIImageView alloc] init];
        [self addSubview:self.backImageView];
        [_backImageView release];
        self.button = [UIButton buttonWithType:UIButtonTypeSystem];
        [self.button setTitle:@"查看全部" forState:UIControlStateNormal];
        [self addSubview:self.button];
        
        self.userInteractionEnabled = YES;
    }
    return self;
}

- (void)applyLayoutAttributes:(UICollectionViewLayoutAttributes *)layoutAttributes
{
    [super applyLayoutAttributes:layoutAttributes];
    CGFloat widths = layoutAttributes.frame.size.width;
    CGFloat heights = layoutAttributes.frame.size.height;
    self.myImageView.frame = CGRectMake(0, 0, widths / 8, heights);
    self.label.frame = CGRectMake(widths / 8 + 10, 0, widths / 2, heights);
    self.backImageView.frame = layoutAttributes.bounds;
    self.button.frame = CGRectMake(widths * 3 / 4, 0, widths / 4, heights);
    
}


@end
